package com.lixinyue.test02;

/**
 * @program: 11.12
 * @description:
 * @author: 李鑫月
 * @create: 2021-11-12 09:47
 **/
class Animal{
    public String name;
    public  int age;
    protected int count;
    public Animal(String name,int age){
        this.name=name;
        this.age=age;
    }

    public void  eat(){
        System.out.println(this.name+"is eating");
    }
}
class Dog extends Animal{
    public Dog(String name,int age){
    super(name,age);//显式调用构造方法，调用父类调用两个参数的构造方法
    }
    //默认的构造方法
//    public Dog(){
//        super();//显式调用构造方法，调用父类调用两个参数的构造方法
//    }

        }

 class Bird extends Animal{
    public String wing;
    public String name;
    public Bird(String name,int age,String wing){
        super(name,age);
        this.wing=wing;
    }
    public void  fly(){
        System.out.println(super.name+super.age+"岁 "+"is flying");
    }
}
class Red extends Bird{
    public int colo;

    public Red(String name, int age,String wing) {
        super(name, age,wing);
    }
}

public class TestDemo1 {
    public static void main(String[] args) {
        Dog dog=new Dog("zqw",19);
        Animal animal=dog;
        Animal animal1=new Dog("zqw",10);
    }
    public static void main2(String[] args) {
        Bird bird=new Bird("lixinyue",11,"tianshi");
        System.out.println(bird.count);

    }

    public static void main1(String[] args) {
        Dog dog=new Dog("kk",12);
//        dog.name="lixinru";
        System.out.println(dog.name);
        dog.eat();
        Bird bird=new Bird("lixinyue",11,"tianshi");
        System.out.println(bird.wing);
        bird.fly();
    }
}
